food_type(velveeta, cheese).
food_type(ritz, cracker).
food_type(spam, meat).
food_type(sausage, meat).
food_type(jolt, soda).
food_type(twinkie, dessert).

flavor(sweet, dessert).
flavor(savory, meat).
flavor(savory, cheese).
flavor(sweet, soda).

%% X is a food. Inferred from the call to food_type(X, Z).
%% Y is a flavor. Inferred from the call to flavor(Y, Z).
%% Z is a food type. Inferred from the call to food_type(X, Z) and flavor(Y, Z).
food_flavor(X, Y) :- food_type(X, Z), flavor(Y, Z).
